﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;

namespace baiduNLP
{
  class Program
  {
    static void Main(string[] args)
    {
      GetAccessToken token = new GetAccessToken();
      string fileName = "../../../" + DateTime.Now.Ticks.ToString() + ".json";
      Sentiment s =
        new Sentiment("https://aip.baidubce.com/rpc/2.0/nlp/v1/sentiment_classify?charset=UTF-8&access_token=",
          token.AccessToken);
      List<WordModel> wordsList = readExcel.read("../../../ciyunADJ.xlsx");

      List<sentimentModel> sentimentList = s.GetSentimentList(wordsList);
      File.WriteAllText(fileName, JsonSerializer.Serialize(sentimentList));

      Console.WriteLine();
    }
  }
}